<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<jsp:include page="../iframe/base_title.jsp"></jsp:include>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="js/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css"/>
<script type="text/javascript" src="js/jquery-1.7.min.js"></script>
<script type="text/javascript" src="js/ztree/js/jquery.ztree.core-3.3.js"></script>
<script type="text/javascript" src="js/ztree/js/jquery.ztree.excheck-3.3.js"></script>

<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">
<!--
	//设置加载

	//加载数据，并生成导航

	var setting = {
		check : {
			enable : false
		},
		data : {
			simpleData : {
				enable : true
			}
		}
	};

	var zNodes;

	function setCheck() {
		var list = $.fn.zTree.getZTreeObj("treeDemo").getCheckedNodes(true);
		var str = "";
		for ( var i = 0; i < list.length; i++) {
			var obj = list[i];
			if (!obj.isParent) {
				str += obj.id + ":" + obj.name + ",\r\n";
			}
		}
		alert(str);
	}
	
	function load(){
		$.getJSON('<s:url action="bbsType!openList$" />', function(bbsTypes){
			zNodes = bbsTypes;
			$.fn.zTree.init($("#treeDemo"), setting, zNodes);
			expandAll(true);
		});
		
	}

	$(document).ready(function() {
		init();
	});
	
	function init(){
		load();
	}

	function expandAll(expandFlag) {
		$.fn.zTree.getZTreeObj("treeDemo").expandAll(expandFlag);
	}
//-->
</script>
</head>
<body>
	<div class="zTreeDemoBackground left" style="height: auto; width: 100%;">
		<form id="applyUserRightManageForm"
			action="<s:url action="applyUser!applyUserRightManage" namespace="corporation" />"
			method="post">
			<a href="javascript:void(0);" onclick="expandAll(true)">展开全部</a> <a
				href="javascript:void(0);" onclick="expandAll(false)">关闭全部</a> <input
				type="button" onclick="init()" value="init" />
			<ul id="treeDemo" class="ztree"></ul>
		</form>
	</div>
</body>
</html>